package com.gst.cloudygovernance.fragment;

import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.gst.cloudygovernance.R;
import com.gst.cloudygovernance.adapter.AlarmPagerAdapter;
import com.gst.cloudygovernance.base.BaseFragment;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by YBH on 2017/12/18.
 */

public class AlarmFragment extends BaseFragment {
    @Bind(R.id.tablayout)
    TabLayout tablayout;
    @Bind(R.id.view_pager)
    ViewPager viewPager;
    private AlarmPagerAdapter adapter;

    @Override
    public View initView() {
        View view = View.inflate(mContext, R.layout.alarm_pager, null);
        return view;
    }

    @Override
    public void initData() {
        super.initData();
        adapter = new AlarmPagerAdapter(getFragmentManager());
        viewPager.setAdapter(adapter);
        tablayout.setupWithViewPager(viewPager);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // TODO: inflate a fragment view
        View rootView = super.onCreateView(inflater, container, savedInstanceState);
        ButterKnife.bind(this, rootView);
        return rootView;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.unbind(this);
    }
}
